module RegexDefinitionView where

import Graphics.UI.Gtk

data ViewState = ViewState
    {
      mainWidget :: Widget
    , regexE :: Entry
    , errorL :: Label
    , applyB :: Button
    }

new :: Widget -> IO ViewState
new openSaveW = do
  e <- entryNew 
  vbox <- vBoxNew False 2
  hbox <- hBoxNew False 2
  boxPackStart vbox e PackGrow 2
  boxPackStart vbox hbox PackNatural 2
  l <- labelNew Nothing
  applyB <- buttonNewFromStock stockApply
  boxPackStart hbox openSaveW PackNatural 2
  boxPackStart hbox l PackNatural 2
  boxPackEnd hbox applyB PackNatural 2
  return (ViewState (toWidget vbox) e l applyB)
